<template>
 <div class="container">
   <div ref="chart_ref" style="width: 600px; height: 400px"></div>
 </div>
</template>

<script>
export default {
  name: 'news',
  components: {},
  props: {},
  data () {
    return {

    }
  },
  computed: {},
  watch: {},
  created () {},
  mounted () {
    // this.getData()
    this.initChart()
  },
  methods: {
    getData () {
      this.$axios.get('http://api.tianapi.com/areanews/index?key=acc54cc8991613d1ef9f79b5b536b8f9&areaname=浙江&word=疫情').then(res => {
        console.log('疫情新闻', res) // 疫情 教育 天气等都行
      }).catch(err => {
        console.log(err)
      })
    },
    initChart () {
      var mChart = this.$echarts.init(this.$refs.chart_ref)
      const option = {
        xAxis: {
          type: 'category',
          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
        },
        yAxis: {
          type: 'value'
        },
        series: [{
          data: [150, 230, 224, 218, 135, 147, 260],
          type: 'line'
        }]
      }
      mChart.setOption(option)
    }
  }
}
</script>

<style scoped lang="less">

</style>
